/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package search2;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 *
 * @author user
 */
public class AStar2 implements MyQueue {

    PriorityQueue<Node2> queue = new PriorityQueue<Node2>(100, new Comparator<Node2>() {

        /**
         * return positive if first is greater then second.
         */
        @Override
        public int compare(Node2 o1, Node2 o2) {
            return o1.f - o2.f;
        }
    });

    public Node2 poll() {
        return queue.poll();
    }

    public void add(Node2 n) {
        queue.add(n);
    }

    public boolean isEmpty() {
        return queue.isEmpty();
    }

    public void clear() {
        queue.clear();
    }
}
